package com.ws.shop.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ws.shop.dao.AdminRoleDao;
import com.ws.shop.entity.AdminRole;
import com.ws.shop.service.AdminRoleService;

@Service(value="adminRoleService")
public class AdminRoleServiceImpl implements AdminRoleService {
	@Resource(name="adminRoleDao")
	private AdminRoleDao adminRoleDao;

	@Transactional(rollbackFor=Exception.class)
	public Object[] deleteRoleById(int id) {
		return adminRoleDao.deleteRoleById(id);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public AdminRole findRoleById(int id) {
		return adminRoleDao.findRoleById(id);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public List<AdminRole> findRoleListAll() {
		return adminRoleDao.findRoleListAll();
	}

	@Transactional(rollbackFor=Exception.class)
	public void saveOrUpdate(AdminRole role) {
		adminRoleDao.saveOrUpdate(role);
	}

	@Transactional(rollbackFor=Exception.class)
	public void saveAdminRolePerm(int roleid, int[] menuids) {
		adminRoleDao.saveAdminRolePerm(roleid, menuids);
	}

}
